package abc.com.abc.activity;

import android.database.DataSetObserver;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Adapter;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

import abc.com.abc.R;
import abc.com.abc.adapter.MyAdapter;
import abc.com.abc.bean.MSGBean;
import abc.com.abc.utils.DBUtils;

public class GlyMsgActivity extends AppCompatActivity {

    private RecyclerView recyclerView;
    private RecyclerView.Adapter adapter;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       /* List<MSGBean> list = DBUtils.getInstance(this).getAllMsg();
        setContentView(R.layout.activity_gly_msg);
        recyclerView = findViewById(R.id.lv_msg);
        adapter = new MyAdapter(this,list);
        recyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false));
        recyclerView.setAdapter(adapter);*/
        List<MSGBean> list = DBUtils.getInstance(this).getAllMsg();
        setContentView(R.layout.activity_gly_msg);
        recyclerView = findViewById(R.id.lv_msg);
        adapter = new MyAdapter(this,list);
        recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL,false));
        recyclerView.setAdapter(adapter);

      /*  MyAdapter listRecycleViewAdapter = new MyAdapter(GlyMsgActivity.this,list);
        listRecycleViewAdapter.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(View view, int position) {

            }
        }*/

    }
   /* // 1、首先定义点击的接口
    public interface OnItemClickListener {
        void onItemClick(View view, int position);
    }
*/



}
